﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Common="clr-namespace:Twi.COMMON.WPF"
                    x:Class="Twi.COMMON.WPF.DataGrid1">

    <Style x:Key="TreeExpanderStyle" TargetType="CheckBox">
        <Setter Property="Background" Value="#FF448DCA"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="IsExpandedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="IsCollapsedIcon" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Indeterminate">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Path x:Name="IsExpandedIcon" Data="M2,2 L14,2 L7,14 z" Fill="Gray" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" />
                        <Path x:Name="IsCollapsedIcon" Data="M2,2 L14,7 L2,14 z" Fill="Gray" UseLayoutRounding="False" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <EventSetter Event="CheckBox.Click" Handler="TreeExpander_Click"></EventSetter>
        <Setter Property="Visibility">
            <Setter.Value>
                <Binding Path="ExpanderVisibility" Mode="OneWay"></Binding>
            </Setter.Value>
        </Setter>
        <Setter Property="IsChecked">
            <Setter.Value>
                <Binding Path="IsExpanded"></Binding>
            </Setter.Value>
        </Setter>
        <Setter Property="Cursor" Value="Hand"></Setter>
        <Setter Property="Margin">
            <Setter.Value>
                <Binding Path="Level">
                    <Binding.Converter>
                        <Common:LevelToMarginConverter></Common:LevelToMarginConverter>
                    </Binding.Converter>
                </Binding>
            </Setter.Value>
        </Setter>
        <Setter Property="Tag">
            <Setter.Value>
                <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}"/>
            </Setter.Value>
        </Setter>
    </Style>
    
    
    
    <Style TargetType="{x:Type DataGrid}">
        <Setter Property="AlternatingRowBackground" Value="AliceBlue"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="RowHeight" Value="25"/>
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
    </Style>

    <Style TargetType="{x:Type Common:CustomDataGrid}">
        <Setter Property="AlternatingRowBackground" Value="AliceBlue"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="RowHeight" Value="25"/>
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="AutoGenerateColumns" Value="False"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
    </Style>
    
    <!--<Style TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
    </Style>-->
    
    <Style x:Key="StyleDataGridColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
    </Style>
    
    <Style TargetType="DataGridCell">
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="#B1DAF8"/>
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!--<Style TargetType="DataGridRow">
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="#B1DAF8"/>
            </Trigger>
        </Style.Triggers>
    </Style>-->
</ResourceDictionary>